<?php

namespace app\admin\controller;

use think\Controller;

class Index extends Controller
{
    public function index()
    {
        if (request()->isAjax()) {
            $data = input('post.');
            $result = model('Admin')->login($data);
            if ($result == 1) {
                $this->success('登录成功！', 'admin/home/index');
            }else {
                $this->error($result);
            }
        }
        return view('login');
    }

    public function loginout()
    {
        session(null);
        if (session('?adminuser')) {
            $this->error('退出失败！');
        }else {
            $this->success('退出成功！', 'admin/index/index');
        }
    }
}
